package client.comm.baoding.ui.vm

import android.app.Application
import android.content.Intent
import client.comm.baoding.ui.TextContentActivity
import client.comm.baoding.ui.viewmodel.MiddleVm
import client.comm.baoding.utils.ReadAssetsUtil
import client.comm.commlib.ContextProvider

class AboutViewModel (app: Application) : MiddleVm(app) {

    fun user_protocol() {
        ContextProvider.get().activity?.apply {
            startActivity(
                Intent(this, TextContentActivity::class.java)
                    .putExtra("title", "用户协议")
                    .putExtra(
                        "content",
                        ReadAssetsUtil.getJson("userprotocol.txt", ContextProvider.get().activity)
                    )
            )
        }
    }

    fun privacy_policy() {
        ContextProvider.get().activity?.apply {
            startActivity(
                Intent(this, TextContentActivity::class.java)
                    .putExtra("title", "隐私政策")
                    .putExtra(
                        "content",
                        ReadAssetsUtil.getJson("agreement.txt", ContextProvider.get().activity)
                    )
            )
        }
    }

}
